<template>
	<view class="contont">
		<nav-bar :title="title" :iconLeft="true" />
		<view class="content-bgc">
			<custom-list-de :record="detail_record" :columns="columns">
				<template #status_display="{ text, record }">
					<up-tag v-if="text == '已报废'" size="mini" :text="text" type="info" plain plainFill />
					<up-tag v-if="text == '闲置'" size="mini" :text="text" type="warning" plain plainFill />
					<up-tag v-if="text == '运行中'" size="mini" :text="text" type="primary" plain plainFill />
					<up-tag v-if="text == '维修中'" size="mini" :text="text" type="error" plain plainFill />
				</template>
			</custom-list-de>
		</view>
	</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import deDeviceApi from '../../../api/device/de_list'

const detail_record = ref({})
const title = '设备档案详情';
onLoad(option => {
	get_detail(option.id);
})


const columns = [
	// { title: "照片", dataIndex: 'picture', scopedSlots: 'picture' },
	{ title: "编号", dataIndex: 'code' },
	{ title: "设备名称", dataIndex: 'name' },
	{ title: "设备类型", dataIndex: 'classify_name' },
	{ title: "设备品牌", dataIndex: 'brand' },
	{ title: "设备型号", dataIndex: 'model' },
	{ title: "序列号SN", dataIndex: 'sn' },
	{ title: "制造商", dataIndex: 'manufacturer' },
	{ title: "供应商", dataIndex: 'supplier' },
	{ title: "设备型号", dataIndex: 'model' },
	{ title: "采购日期", dataIndex: 'purchase_date' },
	{ title: "保修到期日", dataIndex: 'warranty_date' },
	{ title: "启用日期", dataIndex: 'use_start_date' },
	{ title: "采购价格", dataIndex: 'purchase_price' },
	{ title: "安装地点", dataIndex: 'model', note: true },
	{ title: "使用状态", dataIndex: 'status_display', scopedSlots: 'status_display' },
	{ title: "备注", dataIndex: 'desc', note: true },
]
function get_detail(id) {
	deDeviceApi.device_detail(id).then(data => {
		detail_record.value = data
	})
	deDeviceApi.get_device_repair_record(5)
}
const previewImage = (img) => {
	// uniapp 原生预览图片方法
	uni.previewImage({
		current: img.url || img,  // 当前显示图片
		urls: [img.url || img]    // 图片列表
	})
}

</script>

<style lang="scss"></style>